<?php
/**
 * BQue Description
 * @package core.lib
 * @name Registry
 * @filesource Registry.php
 * @author Meta Sanjaya
 */

class Registry extends stdClass
{
    /**
     * @access private
     * @staticvar
     * @var Array _registry
     */
    private static $_registry;

    /**
     * @access public
     * @method __construct
     * @param void
     * @return void
     */
    public function __construct()
    {
        if( !is_array( self::$_registry ) )
        {
            self::$_registry = array();
        }
    }

    /**
     * @access protected
     * @method __set
     * @param String $name
     * @param Class $value
     * @return void
     */
    protected function  __set($name,  &$value)
    {
        self::set($name, &$value);
    }

    /**
     * @access protected
     * @method __get
     * @param String $name
     * @return Class
     */
    protected function  &__get($name)
    {
        return self::get($name);
    }

    /**
     * @access public
     * @method set
     * @static
     * @param String $name
     * @param Class $value
     * @return void
     */
    public static function set($name, &$value)
    {
        self::$_registry[$name] =& $value;
    }

    /**
     * @access public
     * @method get
     * @static
     * @param String $name
     * @return Class
     */
    public static function &get($name)
    {
        return self::$_registry[$name];
    }
}
?>
